#ifndef __CryptoSocket__
#define __CryptoSocket__

#include "Poco/Exception.h"
#include "Poco\net\DatagramSocket.h"
#include "Poco\Net\StreamSocket.h"
#include "Poco\Net\SocketAddress.h"
#include <iostream>

using Poco::Exception;
using Poco::Net::DatagramSocket;
using Poco::Net::SocketAddress;
using Poco::Net::StreamSocket;

using namespace std;

class CryptoSocket
{
public:
    CryptoSocket(const string server_ip, unsigned short server_port);
    ~CryptoSocket();
    int Send(void* buffer, int length, int flags = 0);
    int Recv(void* buffer, int length, int flags = 0);
private:
    void Init();
    StreamSocket s;
    SocketAddress addr;
    string ip;
    unsigned short port;
    bool inited;
};

#endif //__CryptoSocket__